package com.panshi.controller;

import com.panshi.entity.AppCollect;
import com.panshi.service.CollectService;
import com.panshi.tools.DataResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 问题收藏controller
 */
@RestController
@Api(tags = "问题收藏业务接口")
public class CollectController {

    @Autowired
    private CollectService collectService;

    @ApiOperation("增加收藏记录")
    @ApiImplicitParam(name = "appCollect", value = "收藏对象", required = true)
    @PostMapping("collect/add")
    public DataResult add(@RequestBody AppCollect appCollect){
        System.out.println(appCollect);
        return collectService.add(appCollect);
    }

    @ApiOperation("删除收藏记录")
    @ApiImplicitParam(name = "collectId", value = "收藏id", required = true)
    @GetMapping("collect/delete/{collectId}")
    public void delete(@PathVariable Integer collectId){
        collectService.delete(collectId);
    }



}
